<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    function arr(arr, k) {
      const map = new Map()
      for (let str of arr) {
        map.set(str, (map.get(str) || 0) + 1)
      }
      for (let [str, count] of map) {
        if (count === 1) {
          k--
          if (k === 0) return str
        }
      }
      return ''
    };
    console.log(arr(["d", "b", "c", "b", "c", "a"], 2));
  </script>
</body>

</html>